package cn.com.fattiger.framework.cms.admin.common.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;

/**
 * 
 * @author fattiger.xiaoyang
 * @date   2016/06/07
 */
@Entity
@Table(name = "wj_question")
public class Question implements Serializable {

	private static final long serialVersionUID = 1L;
	@Id
	@GeneratedValue
    private Long id ;						// 自增主键
    private Long questionnaireId ;			// 问卷id
    private String content ;				// 问题内容
    private Integer type ;					// 问题类型：1单选 2多选 3用户添加内容
    private Integer sequence ;				// 界面显示顺序
    private String remark ;					// 备注
    
    @OneToMany(cascade = {CascadeType.PERSIST,CascadeType.REFRESH})
    @JoinColumn(name = "questionId")
    @OrderBy(value="sequence")
    private List<Option> options = new ArrayList<Option>();
    
    public Long getId (){
        return this.id ;
    }
    public void setId (Long id){
        this.id = id ;
    }
    
    public Long getQuestionnaireId (){
        return this.questionnaireId ;
    }
    public void setQuestionnaireId (Long questionnaireId){
        this.questionnaireId = questionnaireId ;
    }
    
    public String getContent (){
        return this.content ;
    }
    public void setContent (String content){
        this.content = content ;
    }
    
    public Integer getType (){
        return this.type ;
    }
    public void setType (Integer type){
        this.type = type ;
    }
    
    public Integer getSequence (){
        return this.sequence ;
    }
    public void setSequence (Integer sequence){
        this.sequence = sequence ;
    }
    
    public String getRemark (){
        return this.remark ;
    }
    public void setRemark (String remark){
        this.remark = remark ;
    }
    
	public List<Option> getOptions() {
		return options;
	}
	public void setOptions(List<Option> options) {
		this.options = options;
	}
}